Table of Contents
The scripting window allows you to write and execute Python scripts that interact with the Mantid Python API. It can be accessed either by selecting the Script Window option from the View menu in MantidPlot or by pressing F3.
The general options for the script editor are controlled using the Edit and Window menus.
Alongside the standard text copy and paste tools the Edit menu has tools that help format Python code, all of these tools can operate over a subsection of the code which is selected by highlighting it in the editor.
The Window menu contains options relating to the way in which code is displayed in the editor:
The Execution menu contains options regarding the execution of the script, the two main options here are Execute All and Execute Selection.
Note that when using the Execute Selection option you must have the entire line selected as the code is taken from the first highlighted character to the last. For this reason there is also a limitation that prevents you from executing a selection where the first line is indented at any level as this will generate an indentation warning from the Python interpreter since it is effectively seeing an indented block where it would not expect to.
The Clear Variables option is used to clear the local variables in the current script, this is usually not something that would need to be done as it is done automatically before each execution of a script.
The Mode option allows you to switch between running the script asynchronously or serialised with the UI, typically running scripts serialised is not recommended as you will lose control of the MantidPlot UI whilst the script is being executed.
The output pane at the bottom of the window displays the output from the script in the current tab, this shows the times execution of the script has started and finished as well as anything output from the script using print statements.
Right clicking on the output pane opens the context menu which allows you to export the output in multiple ways as well as clearing the window.
Category: Interfaces